package com.atguigu3.common_algorithm.exer2;

/**
 * @author NoobMaster69  * @date 2024/5/25 0025 星期六 11:26
 */
public class ArrayExer2 {
    public static void main(String[] args) {
        int[] arr = {5,4,6,8,9,0,1,2,7,3};

        //求最高分
        //求最低分
        int max = arr[0];
        int min = arr[0];
        int sum = arr[0];
        for (int i = 1; i < arr.length; i++) {
            sum += arr[i];
            if(max < arr[i]){
                max = arr[i];
            }
            if(min > arr[i]){
                min = arr[i];
            }
        }
        //求新数组的平均分
        System.out.println((sum - max + min) / (arr.length - 2 ));
//        System.out.println(min);
//        System.out.println(max);


    }
}
